import 'package:flutter/material.dart';
import './components/item.dart';

Widget getItem() {
  return Card(
    child: TextButton(
      child: Padding(
        padding: EdgeInsets.only(left: 0, top: 10, bottom: 10, right: 0),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Container(
              child: Text(
                '描述',
                style: TextStyle(color: Colors.grey, fontSize: 14),
                maxLines: 3,
                overflow: TextOverflow.ellipsis,
              ),
              margin: EdgeInsets.only(top: 6, bottom: 10),
              alignment: Alignment.topLeft,
            ),
            Padding(padding: EdgeInsets.all(10)),
            Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                demoItem(Icons.star, '1000'),
                demoItem(Icons.link, '1000'),
                demoItem(Icons.subject, '1000'),
              ],
            )
          ],
        ),
      ),
      onPressed: () {
        print('点击了');
      },
    ),
  );
}


class chapterOne2 extends StatefulWidget {
  const chapterOne2({Key? key}) : super(key: key);

  @override
  _chapterOne2State createState() => _chapterOne2State();
}

class _chapterOne2State extends State<chapterOne2> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(
            'expanded 列表',
            style: TextStyle(color: Colors.white),
          ),
          backgroundColor: Theme.of(context).indicatorColor,
        ),
        body: ListView.builder(
            itemCount: 20,
            itemBuilder: (context, index) {
              return getItem();
            }));
  }
}
